import mongoose from "mongoose";
import baseModel from "./base-model";

export enum ArticleStatus {
  Pending = 0,
  Published = 1,
  Frozen = 2
}

export const articleSchema = new mongoose.Schema({
  ...baseModel,
  title: {
    type: String,
    required: true
  },
  author: {
    type: mongoose.Schema.Types.ObjectId,
    ref: "User",
    required: true
  },
  content: {
    type: String,
    required: true
  },
  status: {
    type: Number,
    default: ArticleStatus.Pending
  },
  publish_at: {
    type: Date,
    default: null
  }
});
